package com.wander.patterns.structure.flyweight;

/**
 * @description:享元模式
 *
 * 减少了对象数量,减少了内存空间
 * 外部空间相对独立
 *
 * @author: zhuyong
 * @create: 2019-09-04 13:46
 **/
public class Client {
    public static void main(String[] args) {
        ChessFlyWeight flyWeight1 = FlyWeightFactory.getChess("黑色");
        ChessFlyWeight flyWeight2 = new ConCreateChessFlyWeight("黑色");
        System.out.println(flyWeight1);
        System.out.println(flyWeight2);

        //围棋类  外部状态 位置
        flyWeight1.display(new Coordinate(10,8));
        flyWeight2.display(new Coordinate(8,10));

    }
}
